package com.example.edytor;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RadioGroup;
import android.widget.Toast;
 
public class kolorPedz extends Activity {
 
    Edytor paint;
    Context ctx;
    RadioGroup radioGroup;
 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.paint);
        paint = (Edytor) findViewById(R.id.paintView);
        ctx = getApplicationContext();
    }
 
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.paint, menu);
        return true;
    }
 
    public boolean onOptionsItemSelected(MenuItem item) {
 
        switch (item.getItemId()) {
        case R.id.menu_kolor:
 
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
            alertDialogBuilder.setTitle("Wybor koloru");
            final CharSequence[] items = { "Czerwony", "Zielony", "Niebieski" };
 
            alertDialogBuilder.setItems(items, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    switch (item) {
                    case 0:
                        Edytor.setColor(Color.RED);
                        break;
                    case 1:
                        Edytor.setColor(Color.GREEN);
                        break;
                    case 2:
                        Edytor.setColor(Color.BLUE);
                        break;
                    }
                }
            });
 
            AlertDialog alertDialog = alertDialogBuilder.create();
            alertDialog.show();
 
            break;
 
        }
 
        return true;
    }
}